/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2019-2019.
 * Description: solve the test problem
 * Author: xiaowei
 * Create: 2019-08-03
 */
#include <linux/io.h>
#include <linux/module.h>
#include <linux/hal/cpu_param.h>
#define FIQ_HWFLAG_ADDR 0xf101ff04
#define HI1382_IN_FIQ 0x55555555
unsigned int *fiq_hwflag_addr;

bool hi1382_in_fiq(void)
{
	if (cpu_type_num != HI1382_CPU)
		return false;

	if (fiq_hwflag_addr && readl(fiq_hwflag_addr) == HI1382_IN_FIQ)
		return true;

	return false;
}
static int bugfix_init(void)
{
	if (cpu_type_num != HI1382_CPU)
		return 0;

	fiq_hwflag_addr = (unsigned int *) ioremap(FIQ_HWFLAG_ADDR, 0x4);
	if (fiq_hwflag_addr)
		return 0;
	return -ENOMEM;
}

module_init(bugfix_init);
MODULE_DESCRIPTION("hisi 1382 wtd bugfix");
MODULE_LICENSE("GPL");
MODULE_AUTHOR("HUAWEI TECHNOLOGIES CO., LTD.");

